//控制全屏
function enterfullscreen() { //进入全屏
    window.resizeTo(800, 800);
    $("#fullscreen").html("退出全屏");
    const docElm = document.documentElement;
    //Chrome等
    if (docElm.webkitRequestFullScreen) {
        docElm.webkitRequestFullScreen();
        //alert("Chrome等");
    }
    //W3C
    else if (docElm.requestFullscreen) {
        docElm.requestFullscreen();
        //alert("w3c");
    }
    //FireFox
    else if (docElm.mozRequestFullScreen) {
        docElm.mozRequestFullScreen();
        //alert("FireFox");
    }
    //IE11
    else if (elem.msRequestFullscreen) {
        elem.msRequestFullscreen();
        //alert("IE11");
    } else {
        //alert("other");
    }
}

function exitfullscreen() { //退出全屏
    $("#fullscreen").html("切换全屏");
    if (document.exitFullscreen) {
        document.exitFullscreen();
    } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
    } else if (document.webkitCancelFullScreen) {
        document.webkitCancelFullScreen();
    } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
    }
}

let a = false;
$('#fullscreen').on('click', function () {
    a = !a ? enterfullscreen() : exitfullscreen();
});